package cn.edu.tsinghua.smxq.mobilecity.utils;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
/**
 * 
 * @author chenxi
 * ��ݿ⹤����
 */
public class DBUtils {

	public static final String SQLDRIVER = "com.mysql.jdbc.Driver";
	public static final String CONNECTION = "jdbc:mysql://localhost/mobilecity?"
			+ "user=root";

	public static Connection Connect() {
		Connection conn = null;
		try {
			Class.forName(SQLDRIVER).newInstance();
			conn = DriverManager.getConnection(CONNECTION);
		} catch (InstantiationException e) {			
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return conn;
	}

}

